package com.topica.database.task;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;

public abstract class TopicaDBTask extends AsyncTask<Void, String, Integer> {
	protected Context context;
	protected ProgressDialog dialog;
	protected static final Integer OK = 1;
	protected static final Integer FAIL = -1;
	protected boolean showDialog;

	public TopicaDBTask(Context context) {
		this.context = context;
		dialog = new ProgressDialog(context);
		showDialog = true;
	}

	@Override
	protected void onPreExecute() {
		if (showDialog) {
			dialog.setTitle("Loading...");
			dialog.show();
		}
	}

	@Override
	protected void onPostExecute(Integer result) {
		if (showDialog) {
			dialog.dismiss();
		}
	}

}
